ReadOnly Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Returns a read-only view onto a list. The returned IList<T> interface only allows operations that do not change the list: GetEnumerator, Contains, CopyTo, Count, IndexOf, and the get accessor of the indexer. The IsReadOnly property returns true, indicating that the list is read-only. All other methods on the interface throw a NotSupportedException.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IList<T> ReadOnly<T>(
	IList<T> list
)
Visual Basic (Declaration)
Public Shared Function ReadOnly(Of T) ( _
	list As IList(Of T) _
) As IList(Of T)
Visual C++
public:
generic<typename T>
static IList<T>^ ReadOnly (
	IList<T>^ list
)

Parameters

list
IList<(Of <T>)>
The list to wrap.

Return Value

A read-only view onto list. Returns null if list is null. If list is already read-only, returns list.

Type Parameters

T
The type of items in the list.

Remarks

The data in the underlying list is not copied. If the underlying list is changed, then the read-only view also changes accordingly.

See Also